import type { AddressParams,AddressItem } from '@/types/address'
import { http } from '@/utils/http'

// 添加收货地址
export const postMemberAddressApi = (
  data: AddressParams,
) => {
  return http({
    method: 'POST',
    url: '/member/address',
    data,
  })
}
// 获取收货地址列表
export const memberAddressApi = () => {
  return http<AddressItem[]>({
    method: 'GET',
    url: '/member/address',
  })
}
// 获取收货地址详情
export const memberAddressByIdApi = (id: string) => {
  return http<AddressItem>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
// 修改收货地址
export const putMemberAddressByIdApi = (
  id: string,
  data:AddressParams,
) => {
  return http<AddressItem>({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}
